package controller;

import pojo.Book;
import service.BookService;
import view.BookClassification;
import view.ModifyBook;
import view.QueryView;

import javax.swing.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

public class ModifyBookClickListener implements MouseListener {
    private JTable table;
    private QueryView queryView;
    private BookClassification bookClassification;
    public ModifyBookClickListener(QueryView dialog){
        this.queryView=dialog;
    }
    @Override
    public void mouseClicked(MouseEvent e) {
        int selRow = table.getSelectedRow();
        String bookId = table.getValueAt(selRow,0).toString().trim();
        BookService bookService = new BookService();
        Book book =  bookService.searchId(bookId);
        ModifyBook modifyBook = new ModifyBook(book,null);
    }

    @Override
    public void mousePressed(MouseEvent e) {

    }

    @Override
    public void mouseReleased(MouseEvent e) {

    }

    @Override
    public void mouseEntered(MouseEvent e) {

    }

    @Override
    public void mouseExited(MouseEvent e) {

    }
    public void setTable(JTable table) {
        this.table=table;
    }
}
